package org.ykh.gmall.item.controller;



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.ykh.gmall.item.service.ItemService;
import org.ykh.gmall.result.Result;

import java.util.Map;

@RestController
@RequestMapping("/api/item")
public class ItemApiController {

    @Autowired
    private ItemService itemService;

    /**
     * 商品详情查询
     * /api/item/{skuId}
     * @param skuId
     * @return
     */
    @GetMapping("/{skuId}")
    public Result item(@PathVariable Long skuId){


       Map<String,Object>resultMap= itemService.item(skuId);

        return Result.ok(resultMap);
    }
}
